#!/usr/bin/env node

const fs = require('fs');
//import {fs} from 'fs'
const file = process.argv[2];

//size
//let len = fs.statSync(file).size;
//create Buffer
//let buf  = Buffer.alloc(len);
try{
//open -> handle
  let fid = fs.openSync(file,'r');
  let content = fs.readFileSync(fid,'utf8');
  //read
  fs.writeSync(1,content);
  //console.log(fid.toString('utf8'));
  //close
  fs.closeSync(fid);
}
catch(e){
  console.error(e.message);
  process.exit(1);
}

